Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: split config.Registries into the separate resource. #9780

Merged
merged 1 commit into from
Nov 27, 2024

Conversation

DmitriyMV
Copy link
Member

Required for #9614

Closes #9766

@DmitriyMV DmitriyMV changed the title chore: split config.Registry into the separate resource. chore: split config.Registries into the separate resource. Nov 21, 2024
Copy link
Member

@dsseng dsseng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this could also remove those config definitions from the old place as well?

Copy link
Member

@smira smira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the image/resolver (via PullImage) hasn't been updated

@DmitriyMV
Copy link
Member Author

@smira I think all paths leading to image package are updated now.

// This is a hack, but I (Dmitry) don't have enough patience to figure out why we don't support complex maps
return "resource/definitions/cri/registry.proto", "talos.resource.definitions.cri.RegistryMirrorConfig"
case typeData{"github.com/siderolabs/talos/pkg/machinery/resources/cri", "RegistryConfig"}:
// This is a hack, but I (Dmitry) don't have enough patience to figure out why we don't support complex maps
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the author gave up 😛

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah...

@DmitriyMV
Copy link
Member Author

Integration provision passes, so upgrades work. I'll remove the label to speed-up process.

Copy link
Member

@smira smira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lots of other fixes here as we went through testing image cache

@smira
Copy link
Member

smira commented Nov 26, 2024

Missing bits:

  • some simple unit-test for RegistriesConfig controller - it generate empty on no config, it generates something with config, it enables stuff with image cache config
  • some unit-tests for registryd itself (might be super high-level, using httptest or lower level)

@frezbo
Copy link
Member

frezbo commented Nov 26, 2024

lots of other fixes here as we went through testing image cache

should we split those into a different PR, easier to backport if needed

@smira
Copy link
Member

smira commented Nov 26, 2024

lots of other fixes here as we went through testing image cache

should we split those into a different PR, easier to backport if needed

this also works, probably halt_if_installed is the only important fix that can be backported

@DmitriyMV
Copy link
Member Author

DmitriyMV commented Nov 27, 2024

Updated PR:

  • Print errors to the zap logger (and optionally return from the iterator) during file system iterator call.
  • Add minimal unit-tests for cri.NewRegistriesConfigController and registry.Service.
  • Return proper path errors from registry.MultiPathFS Open and Stat methods.

@@ -127,13 +128,11 @@ func (s *Server) checkSupported(feature runtime.ModeCapability) error {

func (s *Server) checkControlplane(apiName string) error {
switch s.Controller.Runtime().Config().Machine().Type() { //nolint:exhaustive
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if touching this, better to refactor using .IsControlplane() method of the machine.Type

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dropped all irrelevant stuff.

@@ -1228,19 +1227,19 @@ func (s *Server) Logs(req *machine.LogsRequest, l machine.MachineService_LogsSer

switch {
case req.Namespace == constants.SystemContainerdNamespace || req.Id == "kubelet":
var options []runtime.LogOption
var opts []runtime.LogOption
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we please skip in the future changing every line for unrelated changes, and close to beta release specifically. it makes more work for reviewers.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dropped all irrelevant stuff.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've already spent time reviewing it, so now it was wasted... 😭

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry! I thought you wanted me to drop this unrelated stuff.

@@ -0,0 +1,118 @@
// This Source Code Form is subject to the terms of the Mozilla Public
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the file should be registries_config.go to match controller name

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

}

func (suite *ConfigSuite) TestRegistry() {
cfg := config.NewMachineConfig(container.NewV1Alpha1(&v1alpha1.Config{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's a missing case for missing machine config

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added TestRegistryNoMachineConfig.

@@ -38,9 +37,9 @@ func app() error {
return fmt.Errorf("failed to get user home directory: %w", err)
}

it := func(yield func(fs.StatFS) bool) {
it := func(yield func(string2 string) bool) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

string2 ? or should be path?

Copy link
Member Author

@DmitriyMV DmitriyMV Nov 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be nothing, but IDE couldnt figure that out and inserted a placeholder name. Removed.

@DmitriyMV DmitriyMV force-pushed the split-registry branch 2 times, most recently from e040bbb to 1e20ea8 Compare November 27, 2024 16:33
@DmitriyMV
Copy link
Member Author

/m

@talos-bot talos-bot merged commit ccc5a8d into siderolabs:main Nov 27, 2024
50 checks passed
@DmitriyMV DmitriyMV deleted the split-registry branch November 27, 2024 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

image cache: split out config.Registries to a resource and re-wire the controllers
5 participants